<template>
    <div>
        <div style="margin-bottom: 5px">
            <Button @click="btn_refresh" type="primary">刷新</Button> 
        </div>
        <i-table border stripe :columns="format" :data="component_status_list"></i-table >
    </div>
</template>

<script>

import { get_component_status_list } from  '@/api'

import {k8s_cluster_post} from '@/api/http'
export default {
    data() {
        return {
            format: [
                {
                    title: '组件',key: 'name'
                },
                {
                    title: '类型',key: 'type'
                },
                {
                    title: '状态',key: 'status',
                },
                {
                    title: '信息',key: 'message',
                },
                {
                    title: '故障',key: 'error',
                },
            ],
            component_status_list: [],
        }
    },
    methods: {
        btn_refresh(){
            this.refresh()
        },
        refresh() {
            k8s_cluster_post(get_component_status_list).then( (response) => {
                this.component_status_list = response.data
            })
        }
    },
    mounted: function() {
         setTimeout(() =>{
            this.refresh();
        },200); 
    }
}
</script>
<style scoped>

</style>